"use strict";
cc._RF.push(module, 'd9075zpXx1B3JSWeuUP6RTt', 'WeaponLaser');
// scripts/WeaponLaser.js

"use strict";

var t = require;
var e = module;
var o = exports;

var _i,
    n = void 0 && (void 0).__extends || (_i = function i(t, e) {
  return (_i = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _i(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    a = void 0 && (void 0).__decorate || function (t, e, o, i) {
  var n,
      a = arguments.length,
      r = a < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);else for (var s = t.length - 1; s >= 0; s--) {
    (n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
  }
  return a > 3 && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var r = t("GameConstant"),
    s = t("Util"),
    l = cc._decorator,
    c = l.ccclass,
    d = l.property,
    h = function (t) {
  function e() {
    var e = null !== t && t.apply(this, arguments) || this;
    return e.collider = null, e.node_beam = null, e.spine = null, e.isGameOver = !1, e._gameControl = null, e.damageNum = 0, e._carTag = 0, e.playAnimation = function () {
      var t = this;
      this.spine.setAnimation(0, "animation", !1), this._gameControl.playSound(this._gameControl._audioControl.laser_ready), cc.tween(this.node_beam).delay(.7).call(function () {
        t.collider.enabled = !0, t.node_beam.height = 50, t._gameControl.playSound(t._gameControl._audioControl.laser_fire);
      }).to(.5, {
        height: 0
      }).call(function () {
        t.collider.enabled = !1;
      }).start();
    }, e.bCanAttack = !0, e;
  }

  return n(e, t), e.prototype.onLoad = function () {
    this.node_beam.height = 0, this.collider.enabled = !1;
  }, e.prototype.init = function (t, e, o, i, n, a) {
    this._gameControl = t, this.collider.tag = o, this.damageNum = i, this._carTag = n, n == r.Collide_Car_Tag.Left ? (this.node.scaleX = 1, this.node.position = a) : (this.node.scaleX = -1, this.node.position = cc.v3(-a.x, a.y, a.z));
  }, e.prototype.stopAnimation = function () {
    this.unschedule(this.playAnimation);
  }, e.prototype.onGameStart = function () {}, e.prototype.onGameOver = function () {
    this.isGameOver = !0, this.stopAnimation();
  }, e.prototype.onGameBoutReady = function () {
    this.node.active = !1, this.destroy();
  }, e.prototype.onGameBoutStart = function () {
    this.isGameOver = !1, this.playAnimation(), this.schedule(this.playAnimation, s.Util.attackSpeed(2, this._carTag));
  }, e.prototype.onGameBoutOver = function () {
    this.isGameOver = !0, this.stopAnimation();
  }, e.prototype.onCanAttack = function (t) {
    if (this.bCanAttack = t, t) {
      if (this.isGameOver) return;
      this.schedule(this.playAnimation, s.Util.attackSpeed(2, this._carTag));
    } else this.stopAnimation();
  }, e.prototype.getDamage = function () {
    return s.Util.vibrateMiddle(), this.collider.enabled = !1, 2 * this.damageNum;
  }, a([d(cc.Collider)], e.prototype, "collider", void 0), a([d(cc.Node)], e.prototype, "node_beam", void 0), a([d(sp.Skeleton)], e.prototype, "spine", void 0), a([c], e);
}(cc.Component);

o["default"] = h;

cc._RF.pop();